<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
     <div id="app">
         <button @click="flag=!flag">切换</button>
         <h1 v-if=flag>flag</h1>
         <h1 v-show=flag>flag</h1>

         <h1 v-if="num === 1">星期一</h1>
         <h1 v-else-if="num === 2">星期二</h1>
         <h1 v-else-if="num === 3">星期三</h1>
         <h1 v-else-if="num === 4">星期四</h1>
         <h1 v-else="num === 5">星期五</h1>
     </div>
    <script src='https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js'></script>
    <script>
        //v-if和v-show
        //控制元素和组件的显示和隐藏
        //v-if移除dom节点  v-show就是通过display:none控制元素的显示和隐藏

        //v-if可以配合v-else  v-else-if 来使用
        const vm=new Vue({
            el:"#app",
            data:{
                flag:true,
                num:1
            },
            methods: {
                
            }
        })
    </script>
</body>
</html>